$(".leftmdiv").click(function(){
		$(".leftmdiv").removeClass("jianbian");
		$(this).addClass("jianbian");
		if($(this).attr("class").indexOf('leftmb01')>-1){
			$(".leftuserlist").css("display","block");
			$(".leftuserlist2").css("display","none");
		}else{
			$(".leftuserlist").css("display","none");
			$(".leftuserlist2").css("display","block");
		}
});

$(".rightmDiv").click(function(){
	$(".rightmDiv").removeClass("jianbian");
	$(this).addClass("jianbian");
	
	if($(this).attr("class").indexOf('Rightmb01')>-1){
		$(".rightMessageDiv").css("display","block");
		$(".rightMessageDiv1").css("display","none");
		$(".rightMessageDiv2").css("display","none");
	}else if($(this).attr("class").indexOf('Rightmb02')>-1){
		$(".rightMessageDiv").css("display","none");
		$(".rightMessageDiv1").css("display","block");
		$(".rightMessageDiv2").css("display","none");
	}
	else{
		$(".rightMessageDiv").css("display","none");
		$(".rightMessageDiv1").css("display","none");
		$(".rightMessageDiv2").css("display","block");
	}
});

$(document).ready(function(){
	var userName = 'user' + Math.floor((Math.random() * 1000) + 1);
    var socket =  io.connect('http://localhost:9527');
    socket.on('connect', function() {
    });
	socket.on('chatevent', function(data) {
	});
	socket.on('disconnect', function() {
	});
	socket.on('mymessage',function(data){
		var phtml="<p class='mySay'>"+data+":你个二百五</p><br/>";
		$('.showMessageCenter').append(phtml);
	});
	var jsonObject = {username: userName,rank:'111', roomId:'2222'};
	socket.emit('joinRoom', jsonObject);
	
	var jsonObject = {userName: '322323',msgContent: '343443'};
	socket.emit('message', jsonObject);
	
	$("#sendMsgiD").click(function(){
		var messageHtml = $("#saytext").html();
		if($.trim(messageHtml).length==0){
			return false;
		}else{
			var mymessage ={'context':messageHtml}
			socket.emit('getmessage', mymessage);
			$("#saytext").empty();
		}
	});
});
